package cc.geguo

import groovy.util.slurpersupport.GPathResult

/**
 * 作者  Administrator
 * 时间  2017/3/29 14:10
 * 文件  GroovyProject
 * 描述  解析XML
 */

def xparser = new XmlSlurper()

def  targetFile = new File("D:\\IntellWs\\GroovyProject\\test.xml")

GPathResult gPathResult = xparser.parse(targetFile)

def book4 = gPathResult.value.books.book[3]

def author = book4.author

def  authorName = author.text()

println(authorName)